﻿@page "/order/details/{orderNumber:int}"
@using MASA.EShop.Web.Client.Data.Ordering.Record
@inherits EShopBasePage

<PageTitle>Order Detail</PageTitle>

<MContainer>

    <MRow Justify="JustifyTypes.SpaceBetween">
        <MCol Md="3">
            <h2>
                Order number
            </h2>
        </MCol>
        <MCol Md="3">
            <h2>
                Date
            </h2>
        </MCol>
        <MCol Md="3">
            <h2>
                Total
            </h2>
        </MCol>
        <MCol Md="3">
            <h2>
                Status
            </h2>
        </MCol>
        <MCol Md="3">
            @_order.OrderNumber
        </MCol>
        <MCol Md="3">
            @_order.OrderDate
        </MCol>
        <MCol Md="3">
            @_order.Total
        </MCol>
        <MCol Md="3">
            @_order.OrderStatus
        </MCol>
    </MRow>

    <h2 class="mt-4">Shipping address</h2>
    <MContainer>
        <MRow>
            <span>@_order.Address.Street</span>
        </MRow>
        <MRow>
            <span>@_order.Address.City</span>
        </MRow>
        <MRow>
            <span>@_order.Address.Country</span>
        </MRow>
    </MContainer>

    <strong>ORDER DETAILS</strong>
    <MTable TItem="OrderItem" Loading="_loading" Items="_order.OrderItems" HideDefaultHeader HideDefaultFooter>
        <MTableCol>
             <img src="@context.PictureFileName" height="100" width="150" />
        </MTableCol>
        <MTableCol>
            @context.ProductName
        </MTableCol>
        <MTableCol>
            @context.GetFormattedUnitPrice()
        </MTableCol>
        <MTableCol>
            @context.Units
        </MTableCol>
        <MTableCol>
            @context.GetFormattedTotal()
        </MTableCol>
    </MTable>
    <div class="float-right mr-10">
        <div>Total</div>
        <div>$@_order.GetFormattedTotal()</div>
    </div>
</MContainer>
